package cn.minhx.lab.design_patterns.abstract_factory.f1.app;

import cn.minhx.lab.design_patterns.abstract_factory.f1.button.IButton;
import cn.minhx.lab.design_patterns.abstract_factory.f1.checkbox.ICheckbox;
import cn.minhx.lab.design_patterns.abstract_factory.f1.factory.IGUIFactory;

/**
 * Factory users don't care which concrete factory they use since they work with
 * factories and products through abstract interfaces.
 */
public class Application {
    private final IButton button;
    private final ICheckbox checkbox;

    public Application(IGUIFactory factory) {
        button = factory.createButton();
        checkbox = factory.createCheckbox();
    }

    public void paint() {
        button.paint();
        checkbox.paint();
    }
}